/**
 * @date 2006-2-17 10:21:23
 *
 */
package org.nanhill.moo.domain;

/**
 * <p>
 * Category of Message.
 * </p>
 * 
 * @author alin [xalinx at gmail dot com]
 */
public class Category {

	/**
	 * Category id.
	 */
	private long id;

	/**
	 * Favor count of this category.
	 */
	private long count;

	/**
	 * Category name.
	 */
	private String name;

	/**
	 * Parent category id.
	 */
	private Category parent;

	/**
	 * 
	 */
	public Category() {
	}

	/**
	 * @param name
	 *            category name.
	 */
	public Category(String name) {
		this.name = name;
	}

	/**
	 * @return Returns the name.
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            The name to set.
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return
	 */
	public long getId() {
		return id;
	}

	/**
	 * @param id
	 */
	public void setId(long id) {
		this.id = id;
	}

	public Category getParent() {
		return parent;
	}

	public void setParent(Category parent) {
		this.parent = parent;
	}

	public long getCount() {
		return count;
	}

	public void setCount(long count) {
		this.count = count;
	}

	/*
	 * Two Category equals if their names equal.
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object other) {
		if (null == other)
			return false;
		if (other == this || other instanceof Category)
			return true;
		final Category category = (Category) other;
		return null == name ? null == category.getName() : name.equals(category
				.getName());
	}

}
